import salseApi from "@/api/declaration/erp/salseApi"
import httpRequest from "@/config/axios/httpRequest"
import { CustomerModel } from "@/models/erp/CustomerModel"



// ERP 客户 API
export const CustomerApi = {
  // 查询客户分页
  getCustomerPage: async (params: any) => {
    return await httpRequest.get(salseApi.GetCustomerPage, { params })
  },

  // 查询客户精简列表
  getCustomerSimpleList: async () => {
    return await httpRequest.get(salseApi.GetCustomerSimpleList)
  },

  // 查询客户详情
  getCustomer: async (id: number) => {
    return await httpRequest.get(salseApi.GetCustomer, { params: { id } })
  },

  // 新增客户
  createCustomer: async (data: CustomerModel) => {
    return await httpRequest.post(salseApi.CreateCustomer, data)
  },

  // 修改客户
  updateCustomer: async (data: CustomerModel) => {
    return await httpRequest.put(salseApi.UpdateCustomer, data)
  },

  // 删除客户
  deleteCustomer: async (id: number) => {
    return await httpRequest.delete(salseApi.DeleteCustomer, { params: { id } })
  },

  // 导出客户 Excel
  exportCustomer: async (params) => {
    return await httpRequest.download(salseApi.ExportCustomer, params)
  }
}
